<?php

namespace app\api;

class Test extends \LimApi

{

    public function __before()
    {
        return $this;
    }

    #[Attr(uri: 'agent')]
    public function agent($value = '')
    {
        $tmp = \Swoole\Coroutine::getContext();
        loger($tmp['request']);
        \Rs::sadd('agent', $tmp['request']->header['user-agent']);
        $tmp['response']->header('Content-Type', 'text/html;charset=utf-8');
        return $tmp['response']->end('<h1>访问成功</h1>');
        // return time() . ' 11';
    }

    public function register($value = '')
    {
        return config();
    }

    #[Attr(uri: 'redis')]
    public function redis($value = '')
    {
        // $result = \Rs::ft('tasker')->where("@id:[1000 1000]")->search();
        $result = \Rs::hincrby('t', 'a', 1);
        return $result;
    }

}
